<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui" xml:lang="en" lang="en">
	<h:head />
	<body>
		<ui:composition template="/rootWeb.xhtml">
	    <ui:define name="header">
	        <title>模具系列管理</title>
	        <script type="text/javascript">
	        	//点击新增按钮调用 
				function onAddMoldSeries(xhr, status, args){
					if(args.error){
						alert(args.error);
						return ;
					}
					addMoldSeriesDlg.show();
				}
				//保存完成后调用 
				function onSaveMoldSeriesComplete(xhr, status, args){
					if(args.error){
						alert(args.error);
						return ;
					}
					alert(args.msg);
					addMoldSeriesDlg.hide();
				}
				//点击修改按钮调用 
				function onUpdateMoldSeries(xhr, status, args){
					if(args.error){
						alert(args.error);
						return ;
					}
					updateMoldSeriesDlg.show();
				}
				//更新完成后调用 
				function onUpdateMoldSeriesComplete(xhr, status, args){
					if(args.error){
						alert(args.error);
						return ;
					}
					alert(args.msg);
					updateMoldSeriesDlg.hide();
				}
				//点击删除按钮调用 
				function onDeleteMoldSeries(xhr, status, args){
					if(args.error){
						alert(args.error);
						return ;
					}
					deleteMoldSeriesDlg.show();
				}
				
			</script>
			<style type="text/css">
				
			</style>
		</ui:define>
	    <ui:define name="body">
	    	<h:form id="form" prependId="false">
				<p:layout style="min-width:400px;min-height:500px;" id="layout">
					<p:layoutUnit position="west" resizable="true" size="100"  minSize="300" maxSize="500">  
				        <div align="left">
				        	<p:commandButton value="新增" action="#{moldSeriesAction.addMoldSeries}" oncomplete="onAddMoldSeries(xhr, status, args)" update=":form:addMoldSeriesDlgID"/>
				        	<p:spacer width="10"/>
				        	<p:commandButton value="修改" action="#{moldSeriesAction.setUpdateSeries}" oncomplete="onUpdateMoldSeries(xhr, status, args)" update=":form:updateMoldSeriesDlgID"/>
				        	<p:spacer width="10"/>
				        	<p:commandButton value="删除"  action="#{moldSeriesAction.setUpdateSeries}" oncomplete="onDeleteMoldSeries(xhr, status, args)" update=":form:updateMoldSeriesDlgID,:form:deleteMoldSeriesDlgID"/>
				        </div>
				        <p:tree value="#{moldSeriesAction.root}" var="node"  id="moldSeriesTree" style="border: 0px solid #D5D5D5;"
				        	selectionMode="single"  selection="#{moldSeriesAction.selectedNode}">  
				        	<p:ajax event="select" listener="#{moldSeriesAction.onNodeSelect}"  update=":form:selectedNodeInfo"/>
					        <p:treeNode>  
					            <h:outputText value="#{node.seriesName}" />  
					        </p:treeNode>  
					    </p:tree> 
				    </p:layoutUnit>
					<p:layoutUnit position="center" >  
				        <p:outputPanel id="selectedNodeInfo" width="100%">
					        <table width="400">
					        	<tr style="height: 50px"></tr>
					        	<tr><td>
					        		<h:outputText value="名称：" />
					        	</td><td>
					        		<h:outputText value="#{moldSeriesAction.selectedSeries.seriesName}"  styleClass="outputInfoFont"/>
					        	</td></tr>
					        	<tr style="height: 15px"></tr>
					        	<tr><td>
					        		<h:outputText value="代码：" />
					        	</td><td>
					        		<h:outputText value="#{moldSeriesAction.selectedSeries.seriesCode}"  styleClass="outputInfoFont"/>
					        	</td></tr>
					        	<tr style="height: 15px"></tr>
					        	<tr><td>
					        		<h:outputText value="描述：" />
					        	</td><td>
					        		<h:outputText value="#{moldSeriesAction.selectedSeries.seriesRemark}"  styleClass="outputInfoFont"/>
					        	</td></tr>
					        	<tr style="height: 15px"></tr>
					        	<tr><td>
					        		<h:outputText value="创建时间：" />
					        	</td><td>
					        		<h:outputText value="#{moldSeriesAction.selectedSeries.createDate}"  styleClass="outputInfoFont">
					        			<f:convertDateTime pattern="yyyy年MM月dd日" timeZone="GMT+8"/>
					        		</h:outputText>
					        	</td></tr>
					        	<tr style="height: 15px"></tr>
					        	<tr><td>
					        		<h:outputText value="是否可用：" />
					        	</td><td>
					        		<h:selectOneMenu  value="#{moldSeriesAction.selectedSeries.seriesAvailable}"  styleClass="outputInfoFont" disabled="true">  
					        			<f:selectItem itemLabel="" itemValue=""/>
					                	<f:selectItems value="#{moldSeriesAction.availableItems}"/>
					            	</h:selectOneMenu>
					        	</td></tr>
					        	<tr style="height: 15px"></tr>
					        	<tr><td>
					        		<h:outputText value="是否叶子：" />
					        	</td><td>
					        		<h:selectOneMenu  value="#{moldSeriesAction.selectedSeries.isLeaf}"  styleClass="outputInfoFont" disabled="true">  
					        			<f:selectItem itemLabel="" itemValue=""/>
					                	<f:selectItems value="#{moldSeriesAction.yesOrNoItems}"/>
					            	</h:selectOneMenu>
					        	</td></tr>
					        </table>
				        </p:outputPanel>
				    </p:layoutUnit>
				</p:layout>
				
				<p:dialog id="addMoldSeriesDlgID" header="增加模具系列" widgetVar="addMoldSeriesDlg" modal="true" 
					resizable="false">
						<h:panelGrid columns="2" >
							<h:outputLabel for="seriesName" value="名称:" />
							<p:inputText value="#{moldSeriesAction.addSeries.seriesName}" id="seriesName"  maxlength="100"/>
							<p:spacer/><p:spacer/>
							
							<h:outputLabel for="seriesCode" value="代码:" />
							<p:inputText value="#{moldSeriesAction.addSeries.seriesCode}" id="seriesCode"  maxlength="10"/>
							<p:spacer/><p:spacer/>
							
							<h:outputLabel for="seriesDesc" value="描述:" />
							<p:inputText value="#{moldSeriesAction.addSeries.seriesRemark}" id="seriesDesc"  maxlength="250"/>
							<p:spacer/><p:spacer/>
							
							<h:outputLabel for="seriesAvailable" value="是否可用:" />
						 	<h:selectOneMenu id="seriesAvailable" value="#{moldSeriesAction.addSeries.seriesAvailable}" >  
			                	<f:selectItems value="#{moldSeriesAction.availableItems}"/>
			            	</h:selectOneMenu>
			            	<p:spacer/><p:spacer/>
			            	
			            	<f:facet name="footer">
			    				<p:commandButton value="保存" action="#{moldSeriesAction.saveMoldSeries}" update=":form:moldSeriesTree"
			    						oncomplete="onSaveMoldSeriesComplete(xhr, status, args)"/>
			    			</f:facet>
						</h:panelGrid>
				</p:dialog>
				
				<p:dialog id="updateMoldSeriesDlgID" header="修改模具系列" widgetVar="updateMoldSeriesDlg" modal="true" 
					resizable="false">
						<h:panelGrid columns="2" >
							<h:outputLabel for="seriesName_update" value="名称:" />
							<p:inputText value="#{moldSeriesAction.updateSeries.seriesName}" id="seriesName_update"  maxlength="100"/>
							<p:spacer/><p:spacer/>
							
							<h:outputLabel for="seriesDesc_update" value="描述:" />
							<p:inputText value="#{moldSeriesAction.updateSeries.seriesRemark}" id="seriesDesc_update"  maxlength="250"/>
							<p:spacer/><p:spacer/>
							
							<h:outputLabel for="seriesAvailable_update" value="是否可用:" />
						 	<h:selectOneMenu id="seriesAvailable_update" value="#{moldSeriesAction.updateSeries.seriesAvailable}" >  
			                	<f:selectItems value="#{moldSeriesAction.availableItems}"/>
			            	</h:selectOneMenu>
			            	<p:spacer/><p:spacer/>
			            	
			            	<f:facet name="footer">
			    				<p:commandButton value="更新" action="#{moldSeriesAction.updateSeries}" update=":form:moldSeriesTree,:form:selectedNodeInfo"
			    						oncomplete="onUpdateMoldSeriesComplete(xhr, status, args)"/>
			    			</f:facet>
						</h:panelGrid>
				</p:dialog>
				
				<!-- 删除模具系列-->
				<p:confirmDialog id="deleteMoldSeriesDlgID" message="确认删除模具系列吗?"
					header="删除模具系列" severity="alert" widgetVar="deleteMoldSeriesDlg">
					<p:commandButton value="确定" update=":form:moldSeriesTree,:form:selectedNodeInfo" action="#{moldSeriesAction.doDeleteMoldSeries}"
						oncomplete="if(this.args.error){alert(this.args.error)}else{alert(this.args.msg);}deleteMoldSeriesDlg.hide();"  />
					<p:commandButton value="取消" onclick="deleteMoldSeriesDlg.hide()" type="button" />
				</p:confirmDialog>
			</h:form>
	    </ui:define>
		</ui:composition>
	</body>
</html>
